using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableStoryDialog2Dao:DaoBase<TableStoryDialog2>
    {
        public override void AddPrimaryIndex(TableStoryDialog2 model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableStoryDialog2.txt";
        }

        protected override TableStoryDialog2 ParseRowData(string[] rowData)
        {
            TableStoryDialog2 data = new TableStoryDialog2();
			data.id = rowData [0];
			data.groupId = rowData [1];
			data.talker = rowData [2];
			data.name = rowData [3];
			data.content = rowData [4];
			data.background = rowData [5];
			data.sound = rowData [6];
			data.heroIds0 = rowData [7];

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.heroPos0 = 0;
            }
            else
            {
                data.heroPos0 = double.Parse(rowData[8]);
            }
			data.faces0 = rowData [9];
			data.heroIds1 = rowData [10];

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.heroPos1 = 0;
            }
            else
            {
                data.heroPos1 = double.Parse(rowData[11]);
            }
			data.faces1 = rowData [12];
			data.heroIds2 = rowData [13];

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.heroPos2 = 0;
            }
            else
            {
                data.heroPos2 = double.Parse(rowData[14]);
            }
			data.faces2 = rowData [15];
			data.heroIds3 = rowData [16];

            if (string.IsNullOrEmpty(rowData[17]))
            {
                data.heroPos3 = 0;
            }
            else
            {
                data.heroPos3 = double.Parse(rowData[17]);
            }
			data.faces3 = rowData [18];

            return data;
        }


        public override void AddOneIndex(TableStoryDialog2 model)
        {
            if (!cacheOneIndex.ContainsKey(model.groupId.ToString()))
            {
                cacheOneIndex[model.groupId.ToString()] = new List<TableStoryDialog2>();
            }
            cacheOneIndex[model.groupId.ToString()].Add(model);
        }
    

    }

}
